init_dates = function(checkin_id, checkout_id) {

    console.log('init');

    var date = new Date();
    var start = checkin_id;
    var end = checkout_id;

    //  limiter 1 - today is not available
    //  limiter 0 - today is available
    var limiter = 1;

    var m = date.getMonth(),
            d = date.getDate() + limiter,
            y = date.getFullYear();

    // Disable all dates till today
    $(start).datepicker({
        minDate: new Date(y, m, d),
        dateFormat: 'dd.mm.yy',
        showOn: 'both',
        buttonImage: "img/calendar.png",
        buttonImageOnly: true,
        nextText: '&raquo;',
        prevText: '&laquo;',
        dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
        showOtherMonths: true,
        firstDay: 1, // Start with Monday
        onSelect: function(dateStr) {

            var depart = $.datepicker.parseDate('dd.mm.yy', dateStr);

            $(end).datepicker("option", "minDate", depart);

            depart.setDate(depart.getDate() + limiter);
            $(end).datepicker("setDate", depart);

        }
    });

    $(end).datepicker({
        minDate: new Date(y, m, d),
        dateFormat: 'dd.mm.yy',
        showOn: 'both',
        buttonImage: "img/calendar.png",
        buttonImageOnly: true,
        nextText: '&raquo;',
        prevText: '&laquo;',
        dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
        showOtherMonths: true,
        firstDay: 1, // Start with Monday
        onSelect: function(dateStr) {
            //$(hidden_end).val($.datepicker.formatDate('dd.mm.yy', $(end).datepicker('getDate')));
        }
    })

    // SET DATE
    $(start).datepicker('setDate', new Date(y, m, d));
    $(end).datepicker('setDate', new Date(y, m, d + 1));

    // Set custom class
    $("#ui-datepicker-div").addClass("newcalendar");
    $("#ui-datepicker-div").addClass("singleCalendar");


    function set_checkin_checkout() {

        //set pickupdate from session
        var n1 = check_in.split(".");
        $(start).datepicker('setDate', new Date(n1[2], n1[1] - 1, n1[0]));

        // set mindate for checkout
        $(end).datepicker("option", "minDate", new Date(n1[2], n1[1] - 1, parseInt(n1[0]) + 1));

        //set returndate from session
        var n2 = check_out.split(".");
        $(end).datepicker('setDate', new Date(n2[2], n2[1] - 1, n2[0]));
    }

    // METHOD IS SEARCH - set dates from $session variable
//        if ((method == "search" || method == "details") && (non_specific_dates != 1)) {
//
//            set_checkin_checkout();
//
//        }
//          
//        if (typeof is_post_room_search !== 'undefined') {
//
//            set_checkin_checkout();
//
//        }

}